package com.iwhalecloud.uncc.feign;

import com.iwhalecloud.uncc.model.MqClusterConfig;
import com.iwhalecloud.uncc.model.RedisConfig;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.jdbc.support.rowset.SqlRowSet;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient(value = "UNCC-SERVICE-SERVER")
public interface CommonFeignClientService{

    /**
     *  获取系统参数
     *
     * @param code
     * @return
     */
    @PostMapping("/sysConfig/getSysConfigSpec")
    String getSysConfigSpec(@RequestParam("code") String code);

    /**
     * 获取module配置表信息
     *
     * @param module module
     * @param appName appName
     * @param code  code
     * @return string
     */
    @PostMapping(value="/sysConfig/getModuleConfig")
    String getModuleConfig(@RequestParam("module") String module, @RequestParam("appName") String appName,
                           @RequestParam("code") String code);


    /**
     * 获取redis配置表信息
     *
     * @param clusterCode
     * @return string
     */
    @PostMapping(value="/sysConfig/getRedisConfig")
    RedisConfig getRedisConfig(@RequestParam("clusterCode") String clusterCode);

    /**
     * 获取mq配置
     *
     * @param mqCode mqCode
     * @return mqClusterConfig
     */
    @PostMapping("/sysConfig/getMqClusterConfig")
    MqClusterConfig getMqClusterConfig(@RequestParam("mqCode") String mqCode);

    /**
     * 获取本地序列id
     *
     * @param  seqName seqName
     * @param batchSize batchSize
     * @return long
     */
    @PostMapping("/sysConfig/getLocalSeq")
    Long getLocalSeq(@RequestParam("seqName") String seqName, @RequestParam("batchSize") int batchSize);

    /**
     * 获取ctg序列id
     *
     * @param  seqName seqName
     * @param batchSize batchSize
     * @return long
     */
    @PostMapping("/sysConfig/getCtgSeq")
    List<Long> getCtgSeq(@RequestParam("seqName") String seqName, @RequestParam("batchSize") int batchSize);

    /**
     * 获取普通序列
     *
     * @param seqName seqName
     * @return long
     */
    @PostMapping("/sysConfig/getSimpleSeq")
    Long getSimpleSeq(@RequestParam("seqName") String seqName);

    /**
     * 获取RowSet查询结果
     *
     * @param sql sql
     * @param sps sps
     * @return sqlRowSet
     */
    @PostMapping("/sysConfig/readSqlRowSet")
    SqlRowSet readSqlRowSet(@RequestParam("sql") String sql, @RequestBody Object[] sps);



}